package com.example.test7;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.alibaba.android.arouter.launcher.ARouter;

import butterknife.ButterKnife;


public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button btn1 =findViewById(R.id.btn1);
        Button btn2 =findViewById(R.id.btn2);
        Button btn3 =findViewById(R.id.btn3);
        ARouter.openLog();
        ARouter.openDebug();//由于ARouter会缓存，打开才能即使更新页面
        ARouter.init(getApplication());
        btn1.setOnClickListener(this::onClick);
        btn2.setOnClickListener(this::onClick);
        btn3.setOnClickListener(this::onClick);
    }
    public void onClick(View v) {
        switch(v.getId()){
            case R.id.btn1:
                ARouter.getInstance().build("/app/GravityActivity").navigation();
                break;
            case R.id.btn2:
                ARouter.getInstance().build("/app/LinearAccelActivity").navigation();
                break;
            case R.id.btn3:
                ARouter.getInstance().build("/app/AmbientActivity").navigation();
                break;
        }
    }
}


